package com.zhijiang.hospital.controller;

import com.zhijiang.config.result.R;
import com.zhijiang.hospital.entity.Propose;
import com.zhijiang.hospital.mapper.ProposeMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 75936
 * @version 1.0
 * @project zhijiang_hospital_datas
 * @description
 * @date 2023-03-31 15:48:15
 */
@Slf4j
@Api(value = "建议接口", tags = "建议接口")
@RestController
@RequestMapping("Propose")
public class ProposeController {
    @Autowired
    private ProposeMapper proposeMapper;

    @ApiOperation("意见添加")
    @ApiModelProperty(value = "意见添加")
    @PostMapping("applyPropose")
    public R applyPropose(@RequestBody Propose propose) {
        int insert = proposeMapper.insert(propose);
        if (insert > 0) {
            return R.ok("感谢您的宝贵意见,我们会听取您的建议做的更好");
        }
        return R.exception(222, "系统出错了,请联系管理员");

    }
}
